<template>
  <div>
    <div class="search">
      <form action="/">
        <van-search
          v-model="value"
          show-action
          @input="onSearch"
          @cancel="$router.back()"
          :placeholder="hot_search"
          @search="onsearch_true"
        />
        <!-- @search="onsearch_true"  pc端移动端点击确定/搜索  开始搜索 -->
      </form>

      <!-- 搜索结果    trim()去掉字符串左右空格-->
      <div class="search_result" v-show="value.trim().length">
        <van-cell
          @click="search_result_click(item.title)"
          :title="item.title"
          v-for="item in searchList"
          :key="item._id"
        >
        </van-cell>
      </div>

      <!-- 删除 -->
      <div class="search_history">
        <van-cell title="搜索历史">
          <div @click="search_all_del">
            <span>全部删除</span>
          </div>
        </van-cell>
        <van-cell
          :title="item"
          @click="search_history_click(item)"
          v-for="(item, index) in searchHistory"
          :key="item"
        >
          <van-icon @click="search_del(index)" name="close" />
        </van-cell>
      </div>
    </div>
  </div>
</template>

<script>
import search from "./search";
export default search;
</script>

<style lang="less">
</style>